#include <bits/stdc++.h>
using namespace std;

int n, ans, a[100005];

multiset < int > s1, s2;

int main()
{
	freopen("duel.in", "r", stdin);
	freopen("duel.out", "w", stdout);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	ans = n;
	for (int i = 1; i <= n; i++)
		s1.insert(a[i]);
	set < int > :: iterator it = s1.lower_bound(-1);
	set < int > :: iterator it2 = s1.upper_bound(*it);
	if (it2 == s1.end())
	{
		cout << n << endl;
		exit(0);
	}
	int x1 = *it, x2 = *it2;
	s1.erase(it2);
	it = s1.lower_bound(x1);
	s1.erase(it);
	ans--;
	s2.insert(x2);
	while (1)
	{
		set < int > :: iterator it3 = s2.lower_bound(-1);
		set < int > :: iterator it4 = s1.upper_bound(*it3);
		if (it4 != s1.end())
		{
			s2.erase(it3);
			ans--;
			s2.insert(*it4);
			s1.erase(it4);
		}
		else
		{
			set < int > :: iterator it5 = s1.lower_bound(-1);
			if (it5 == s1.end())
			{
				cout << ans << endl;
				exit(0);
			}
			set < int > :: iterator it6 = s1.upper_bound(*it5);
			if (it6 == s1.end())
			{
				cout << ans << endl;
				exit(0);
			}
			int x4 = *it6;
			s1.erase(it5);
			ans--;
			it6 = s1.lower_bound(x4);
			s1.erase(it6);
			s2.insert(x4);
		}
	}
	return 0;
}
